package test3_11;

import java.util.Arrays;

public class Test_putZeroToTail {
    public static void main(String[] args) {
        /*
        v={3,2,4,5,7,0,0,0,6,0,9,0,8}
         */
        int[] v = {3, 2, 4, 5, 7, 0, 0, 0, 6, 0, 9, 0, 8};
        for (int i = 0; i < v.length; i++) {
            if (v[i] == 0) {
                for (int j = i + 1; j < v.length; j++){
                    if(v[j] != 0){
                        int tmp;
                        tmp = v[i];
                        v[i] = v[j];
                        v[j] = tmp;
                        break;
                    }
                }
            }
        }
        System.out.println(Arrays.toString(v));
    }
}
